package com.soft.javase.day10.practice;

import java.util.function.Function;

/**
 * @author yzg
 * @desc TODO
 * @date 2025/5/4
 */
public class FunctionDemo {
    public static void main(String[] args) {
        String str = "张三,20";

        Function<String, String> age = s -> s.split(",")[1];

        Function<String, Integer> toInteger = Integer::parseInt;

        Function<Integer, Integer> add = n -> n + 100;

        Function<String, Integer> ageAdd = age.andThen(toInteger).andThen(add);

        int result = ageAdd.apply(str);

        System.out.println(result);
    }
}
